﻿using System.Xml.Linq;
using Maple.Weixin.MP.Helpers;

namespace Maple.Weixin.MP.Entities.Messages
{
    public sealed class RequestMessageLink : RequestMessageBase
    {
        public override RequestMessageType MsgType
        {
            get { return RequestMessageType.Link; }
        }
        public string Title { get; private set; }
        public string Description { get; private set; }
        public string Url { get; private set; }

        protected override void FillPropertiesByXml(XDocument document)
        {
            base.FillPropertiesByXml(document);
            this.Title = document.GetElementValue("Title", true);
            this.Description = document.GetElementValue("Description", true);
            this.Url = document.GetElementValue("Url", true);
        }

        public override T Accept<T>(RequestMessageVisitor<T> visitor) {
            return visitor == null ? default(T) : visitor.Visit(this);
        }
    }
}
